<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.计算1—100所有偶数之和(使用while实现)
        var sum = 0;
        var i = 1;
        while(i<=100){
            i++;
            if(i % 2 == 0 ){
                
                sum=sum+i;
                
            }
        }
        alert(sum);

    </script>
</body>
</html>